
package com.av.torrent.jobs;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * @author Uladzimir_Kerus
 */
public class GetAllTorrentsInfoJob extends AbstractSubscribableHttpPostJob {

  @Override
  protected JSONObject buildRequestBody() {
    try {
      return innerBuildRequestBody();
    } catch (JSONException e) {
      throw new IllegalStateException("Unable to build requst body", e);
    }
  }

  private JSONObject innerBuildRequestBody() throws JSONException {
    final JSONObject request = new JSONObject();

    request.put("method", "torrent-get");
    request.put("arguments", new JSONObject().put("fields", new JSONArray().put("id").put("name").put("totalSize")));

    return request;
  }
}
